package com.yunhe.common.model.data;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yunhe.common.util.NumberUtil;

import java.util.Date;

public class ElectricityBillDetail implements Comparable<ElectricityBillDetail> {

    private Long id;
    private Long firmCode;
    private Long stationCode;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date date;
    private Double sharpElectricity;
    private Double peakElectricity;
    private Double flatElectricity;
    private Double valleyElectricity;
    private Integer type;
    private String reading;
    private Double totalElectricity;
    private Double chargeCost;
    private Double dischargeProfit;
    private Double profit;


    @Override
    public int compareTo(ElectricityBillDetail o) {
        if (o == null) return 1;
        return this.getDate().compareTo(o.getDate());
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Long getFirmCode() {
        return firmCode;
    }

    public void setFirmCode(Long firmCode) {
        this.firmCode = firmCode;
    }

    public Long getStationCode() {
        return stationCode;
    }

    public void setStationCode(Long stationCode) {
        this.stationCode = stationCode;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Double getSharpElectricity() {
        return sharpElectricity;
    }

    public void setSharpElectricity(Double sharpElectricity) {
        this.sharpElectricity = sharpElectricity;
    }

    public Double getPeakElectricity() {
        return peakElectricity;
    }

    public void setPeakElectricity(Double peakElectricity) {
        this.peakElectricity = peakElectricity;
    }

    public Double getFlatElectricity() {
        return flatElectricity;
    }

    public void setFlatElectricity(Double flatElectricity) {
        this.flatElectricity = flatElectricity;
    }

    public Double getValleyElectricity() {
        return valleyElectricity;
    }

    public void setValleyElectricity(Double valleyElectricity) {
        this.valleyElectricity = valleyElectricity;
    }

    public String getReading() {
        if (reading.contains("\"")) {
            reading = reading.replace("\"", "");
        }
        return reading;
    }

    public void setReading(String reading) {
        if (reading.contains("\"")) {
            reading = reading.replace("\"", "");
        }
        this.reading = reading;
    }

    public Double getTotalElectricity() {
        return NumberUtil.round(sharpElectricity + peakElectricity + flatElectricity + valleyElectricity, 2);
    }

    public void setTotalElectricity(Double totalElectricity) {
        this.totalElectricity = totalElectricity;
    }

    public Double getChargeCost() {
        return chargeCost;
    }

    public void setChargeCost(Double chargeCost) {
        this.chargeCost = chargeCost;
    }

    public Double getDischargeProfit() {
        return dischargeProfit;
    }

    public void setDischargeProfit(Double dischargeProfit) {
        this.dischargeProfit = dischargeProfit;
    }

    public Double getProfit() {
        return profit;
    }

    public void setProfit(Double profit) {
        this.profit = profit;
    }
}
